import axios from '@/request'

export function getCategoryListApi() {
  return axios.get('/admin/category')
}

export function createCategoryApi(data) {
  return axios.post('/admin/category', data)
}

export function updateCategoryApi(id, data) {
  return axios.post('/admin/category/' + id, data)
}

export function updateCategoryStatusApi(id, status) {
  return axios.post(`/admin/category/${id}/update_status`, {
    status,
  })
}

export function deleteCategoryApi(id) {
  return axios.post(`/admin/category/${id}/delete`)
}

export function getCategoryGoodsApi(id) {
  return axios.get(`/admin/app_category_item/list?category_id=${id}`)
}

export function deleteCategoryGoodsApi(id) {
  return axios.post(`/admin/app_category_item/${id}/delete`)
}

export function connectCategoryGoodsApi(data) {
  return axios.post(`/admin/app_category_item`, data)
}
